import {
  SystemZeroCodeSettingJson,
  SystemZeroCodeAutomationTable,
  SystemZeroCodePublicJson,
  SystemZeroCodeFindById,
  SystemWorkSheetTableField,
  SystemWorkSheetTableFieldDelete,
  SystemWorkSheetTableRename,
} from "@/services/api";
import { request, METHOD } from "@/utils/request";

/**
 * 发布
 */
export async function editPublic(form) {
  return request(SystemZeroCodePublicJson, METHOD.POST, form);
}

/**
 * 根据Id获取
 */
export async function findById(id) {
  return request(SystemZeroCodeFindById + "/" + id, METHOD.GET, {});
}

/**
 * 修改表字段
 */
export async function tableField(param) {
  return request(SystemWorkSheetTableField, METHOD.POST, param);
}
/**
 * 删除表字段
 */
export async function tableFieldDelete(param) {
  return request(SystemWorkSheetTableFieldDelete, METHOD.POST, param);
}

/**
 * 表是否存在
 */
export function tableRename(param) {
  return request(SystemWorkSheetTableRename, METHOD.POST, param);
}

/**
 * 获取工作表
 */
export async function table(param) {
  return request(SystemZeroCodeAutomationTable, METHOD.POST, param);
}

/**
 * 发布表单配置
 */
export async function settingJsonPublic(form) {
  return request(SystemZeroCodeSettingJson, METHOD.POST, form);
}

export default {
  editPublic,
  findById,
  tableField,
  table,
  settingJsonPublic,
  tableRename,
  tableFieldDelete,
};
